package com.example.springcloudserviceribbondemo.controller;

import com.example.springcloudserviceribbondemo.service.HelloService;
//import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：Luohuiyong
 * @Description:
 * @Date: Created in 11:24 2018/11/17
 */
@RestController
public class HelloController {
    @Autowired
    HelloService helloService;

    @GetMapping("/hi")
    @HystrixCommand(fallbackMethod="error")
    public String hi(@RequestParam String name){
        return helloService.hiService(name);
    }

    public String error(String name){
        return "hi " + name + "sorry ,i am a error";
    }


}
